<?php

class Page{

	private $styleFiles;
	private $scriptFiles;
	
	private $header;
	private $body;
	private $footer;
	
	public function __construct(){
		$this->styleFiles = new ArrayObject();
		$this->scriptFiles = new ArrayObject();
	}
	
	public function addStyleFile($filename){
		$this->styleFiles->append($filename);	
	}
	
	public function addScriptFile($filename){
		$this->scriptFiles->append($filename);	
	}
	
	public function setHeader($filename){
		$this->header = $filename;	
	}

	public function setBody($filename){
		$this->body = $filename;
	}
	
	public function setFooter($filename){
		$this->footer = $filename;
	}
	
	public function renderPage(){
		foreach($this->styleFiles as $file){
			echo $file."\n";
		}

		echo $this->header."\n";
		echo $this->body."\n";
		echo $this->footer."\n";

		foreach($this->scriptFiles as $file){
			echo $file."\n";
		}
	}
}

$p = new Page();

$p->addStyleFile("style 1");
$p->addStyleFile("style 2");
$p->addStyleFile("style 3");

$p->addScriptFile("script 1");
$p->addScriptFile("script 2");
$p->addScriptFile("script 3");

$p->setHeader("header");
$p->setBody("body");
$p->setFooter("footer");

$p->renderPage();
?>
